/*
 * paymentBO.java
 *
 * Created on March 17, 2007, 2:14 PM
 */

package edu.byu.isys413.mystuff;

/**
 *
 * @author Sam Griffiths
 */
public class paymentBO {
    
    //initialize variables
    private String pmtid;
    private double amt;
    private double change;
    private String type;
    private boolean dirty = false;   
    private boolean alreadyInDatabase = false;
    
    /** Creates a new instance of paymentBO */
    public paymentBO() {
    }
        
    //creates new paymentBO and initializes id
    public paymentBO(String pmtid) {
    this.pmtid = pmtid;
    }
    
    //returns payment id
    public String getPaymentId() {
        return pmtid;
    }

    //returns amount paid by customer
    public double getAmountPaid() {
        return amt;
    }

    //sets amount paid by customer
    public void setAmountPaid(double amt) {
        this.amt = amt;
        setDirty(true);
    }

    //returns Change due to customer
    public double getChange() {
        return change;
    }

    //sets Change due to customer
    public void setChange(double change) {
        this.change = change;
        setDirty(true);
    }

    //returns payment type ie credit, cash
    public String getPaymentType() {
        return type;
    }

    //sets payment type
    public void setPaymentType(String type) {
        this.type = type;
        setDirty(true);
    }
    
    //makes a string from payment attributes
    public String toString(){
        return "Payment id   : "+ this.getPaymentId()+" \n"+
                "Amount Payed: "+ this.getAmountPaid()+" \n"+
                "Change      : "+ this.getChange() +" \n"+
                "Pay by      : "+ this.getPaymentType() +" \n";
    }

    //returns if object has been changed since being read or saved
    public boolean isDirty() {
        return dirty;
    }

    //sets object change
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    //returns if object is already in database
    public boolean isAlreadyInDatabase() {
        return alreadyInDatabase;
    }

    //sets if object is already in database
    public void setAlreadyInDatabase(boolean alreadyInDatabase) {
        this.alreadyInDatabase = alreadyInDatabase;
    }
}